﻿using System.Drawing;

namespace HAOest.Forms.Mouse
{
    /// <summary>
    /// 鼠标调整顶部大小类
    /// </summary>
    public class MouseSizeTop : MouseAction
    {
        private int startMousePositionY;
        /// <summary>
        /// 鼠标调整顶部大小
        /// </summary>
        public MouseSizeTop()
        {
            this.startMousePositionY = Functions.GetMousePosition().Y;
        }

        /// <summary>
        /// 执行方法
        /// </summary>
        /// <param name="form">传入的窗口</param>
        public override void Action(System.Windows.Forms.Form form)
        {
            Point point = Functions.GetMousePosition();
            int bottom = form.Bottom;
            form.Top = point.Y;
            form.Height = bottom - point.Y;
            form.Invalidate();
        }
    }
}